/* $Id: ActionWidgetsFactory.java 137 2011-08-29 20:33:36Z altdotua@gmail.com $ */

package alt.djudge.frontend.client.ui.grids;



import com.google.gwt.user.client.ui.Image;


@SuppressWarnings("rawtypes")
public class ActionWidgetsFactory
{
	public static Image getDeleteActionWidget(Class<? extends DTOEntryGridWrapper> clazz, String[] ids)
	{
		Image img = new Image("/images/icons/b_deltbl.png");
		img.setTitle("Delete entry");
		return img;
	}
	
	public static Image getDisableActionWidget(Class<? extends DTOEntryGridWrapper> clazz, String[] ids)
	{
		Image img = new Image("/images/icons/bd_drop.png");
		img.setTitle("Disable entry");
		return img;
	}
	
	public static Image getEditActionWidget(Class<? extends DTOEntryGridWrapper> clazz, String[] ids)
	{
		Image img = new Image("/images/icons/b_edit.png");
		img.setTitle("Edit entry");
		return img;
	}
	
	public static Image getCopyActionWidget(Class<? extends DTOEntryGridWrapper> clazz, String[] ids)
	{
		Image img = new Image("/images/icons/b_home.png");
		img.setTitle("Copy entry");
		return img;
	}
	
	public static Image getInfoActionWidget(Class<? extends DTOEntryGridWrapper> clazz, String[] ids)
	{
		Image img = new Image("/images/icons/s_info.png");
		img.setTitle("Entry info");
		return img;
	}
	
	public static Image getActionWidget(Class<? extends DTOEntryGridWrapper> clazz, String actionName, String[] ids)
	{
		actionName = actionName.toLowerCase();
		if ("delete".equals(actionName))
		{
			return getDeleteActionWidget(clazz, ids);
		}
		else if ("disable".equals(actionName))
		{
			return getDisableActionWidget(clazz, ids);
		}
		else if ("edit".equals(actionName))
		{
			return getEditActionWidget(clazz, ids);
		}
		else if ("copy".equals(actionName))
		{
			return getCopyActionWidget(clazz, ids);
		}
		else if ("info".equals(actionName))
		{
			return getInfoActionWidget(clazz, ids);
		}
		return new Image("/images/icons/s_warn.png");
	}
}
